package metier;
import junit.framework.TestCase;


public class tstTache extends TestCase {
	
	 public void testGet()
     {
   	  	Tache uneTache = new Tache(8, "Achat de pain", 2, 5, 6);
   	
 			assertTrue(uneTache.getNumTache()== 8);
 			assertTrue(uneTache.getLibelle()== "Achat de pain");
 			assertTrue(uneTache.getChargePreviJoursHomme()== 2);
 			assertTrue(uneTache.getMatriculeCollaborateur()== 5);
 			assertTrue(uneTache.getReferenceContrat()== 6);		
     }
	 
	 public void testSet()
	 {
		 
		 Tache uneTache = new Tache(8, "Achat de pain", 2, 5, 6);
		 
		 uneTache.setLibelle("achat de rien");
		 assertTrue(uneTache.getLibelle()== "achat de rien");
		 
		 uneTache.setChargePreviJoursHomme(5);
		 assertTrue(uneTache.getChargePreviJoursHomme()== 5);
		 
		 uneTache.setMatriculeCollaborateur(2);
		 assertTrue(uneTache.getMatriculeCollaborateur()== 2);
		 
		 uneTache.setReferenceContrat(7);
		 assertTrue(uneTache.getReferenceContrat()== 7);
	 }
	 
	 public void testEquals()
	 {
		Tache uneTache = new Tache(8, "Achat de pain", 2, 5, 6);
		Tache uneTache2 = new Tache(8, "Achat de pain", 2, 5, 6);
		Tache uneTache3 = new Tache(7, "Achat de pain", 2, 5, 6);
     	assertTrue(uneTache.equals(uneTache2));
     	assertFalse(uneTache.equals(uneTache3));
	 }
	 
	 public void testToString()
	 {
		 Tache uneT = new Tache(8, "Achat de pain", 2, 5, 6);
		 String str = 8 +" " + "Achat de pain" + " " + 2 + " " + 5 + " " + 6;
		 
		 String msg = uneT.toString();
		 assertEquals(str, msg);
		 //uneT.getNumTache() + " " + uneT.getLibelle() + " " + uneT.getChargePreviJoursHomme() + " " + uneT.getMatriculeCollaborateur() + " " + uneT.getReferenceContrat();
	 }
	 
	 public void testtoStringDescriptif() {

		 Tache uneT = new Tache(8, "Achat de pain", 2, 5, 6);
     	String msg = uneT.toStringDescriptif();
 		assertEquals("numero : "+ 8 + "\n" + "libelle :" + "Achat de pain" + "\n" + " charge previsionnelle jours homme : " + 2 + "\n" + "matricule collaborateur : " + 5 + "\n" + "reference contrat : " + 6
, msg);
 		
     }


}